<?php

require_once("vMain.php");
class VSite extends VMain{

	public function __construct() {
		parent::__construct();
		$sql = 'SELECT * FROM Entrepot'; 
	    $req = mysql_query($sql) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
	    $sql1 = 'SELECT * FROM TypeArticle';
	    $req1 = mysql_query($sql1) or die('Erreur SQL !<br />'.$sql1.'<br />'.mysql_error());
	    $sql2 = 'SELECT * FROM TypeArticle';
	    $req2 = mysql_query($sql2) or die('Erreur SQL !<br />'.$sql2.'<br />'.mysql_error());

		echo "<br/><br />";
		echo "<h2 class=\"title\">Affichage par site </h2><br /><br />";
		echo "<form action='index.php?do=afficher' method='post'>";
			echo "<select name='listeSite'>";
			echo "<option value='defaut'></option>";
			while ($row=mysql_fetch_array($req)) {
				echo "<option value='";
				echo $row['idSite'];
				echo "'>";
				echo $row['nomSite'];
				echo "</option>";
			}
			echo "</select>";
			echo "<input type='submit' name='siteSelection' size='10' value='Valider'>";
		echo "</form>";
		echo "<br/><br/><br/>";
		echo "<h2 class=\"title\">Affichage des sorties</h2><br /><br />  ";
		echo "<form action='index.php?do=afficher' method='post'>";
			echo "Type :";
			echo "<select name='idType'>";
			echo "<option value='defaut'></option>";
			while ($row=mysql_fetch_array($req1)) {
				echo "<option value='";
				echo $row['idType'];
				echo "'>";
				echo $row['nomType'];
				echo " - ";
				echo $row['modele'];
				echo "</option>";
			}
			echo "</select><br /><br />";
			echo "Jour :";
			echo "<select name='day'>";
			echo "<option value='defaut'></option>";
			for ($i =1 ; $i < 32 ; $i++) {
				echo "<option value='";
				echo substr("0".$i,-2);
				echo "'>";
				echo substr("0".$i,-2);
				echo "</option>";
			}
			echo "</select>";
			echo "Mois :";
			echo "<select name='month'>";
			echo "<option value='defaut'></option>";
			for ($i =1 ; $i < 13 ; $i++) {
				echo "<option value='";
				echo substr("0".$i,-2);;
				echo "'>";
				echo substr("0".$i,-2);;
				echo "</option>";
			}
			echo "</select>";
			echo "Ann&eacute;e :";
			echo "<select name='year'>";
			echo "<option value='defaut'></option>";
			for ($i =2000 ; $i < 2013 ; $i++) {
				echo "<option value='";
				echo $i;
				echo "'>";
				echo $i;
				echo "</option>";
			}
			echo "</select><br /><br />";
			echo "<input type='hidden' name='articleSorti' value='ok'>";
			echo "<input type='submit' name='siteSelection' size='10' value='Valider'>";
		echo "</form>";
		echo "<br/><br/><br/><br/><br/>";
		echo "<h2 class=\"title\">Affichage des entr&eacute;e</h2><br /><br />";
		echo "<form action='index.php?do=afficher' method='post'>";
			echo "Type :";
			echo "<select name='idType'>";
			echo "<option value='defaut'></option>";
			while ($row=mysql_fetch_array($req2)) {
				echo "<option value='";
				echo $row['idType'];
				echo "'>";
				echo $row['nomType'];
				echo " - ";
				echo $row['modele'];
				echo "</option>";
			}
			echo "</select><br /><br />";
			echo "Jour :";
			echo "<select name='day'>";
			echo "<option value='defaut'></option>";
			for ($i =1 ; $i < 32 ; $i++) {
				echo "<option value='";
				echo substr("0".$i,-2);;
				echo "'>";
				echo substr("0".$i,-2);;
				echo "</option>";
			}
			echo "</select>";
			echo "Mois :";
			echo "<select name='month'>";
			echo "<option value='defaut'></option>";
			for ($i =1 ; $i < 13 ; $i++) {
				echo "<option value='";
				echo substr("00".$i,-2);
				echo "'>";
				echo substr("0".$i,-2);;
				echo "</option>";
			}
			echo "</select>";
			echo "Ann&eacute;e :";
			echo "<select name='year'>";
			echo "<option value='defaut'></option>";
			for ($i =2000 ; $i < 2013 ; $i++) {
				echo "<option value='";
				echo $i;
				echo "'>";
				echo $i;
				echo "</option>";
			}
			echo "</select><br /><br />";
			echo "<input type='hidden' name='articleEntre' value='ok'>";
			echo "<input type='submit' name='siteSelection' size='10' value='Valider'>";
		echo "</form>";
		echo "</body>\n";
		echo "</html> \n";
	}
}
?>
